From: robertl Date: Sat, 19 Jun 2010 23:59:06 +0000 (+0000) Subject: Add dialog for mismatched GPSBabel versions, nagware dialog, Mac UI fixes. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~17^2~5 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=628a12021319b17679c16063f6edfb9114dc5b26;p=gpsbabel.git Add dialog for mismatched GPSBabel versions, nagware dialog, Mac UI fixes. --- diff --git a/gui/app.pro b/gui/app.pro index 88e1b3bce..ed8acb15b 100755 --- a/gui/app.pro +++ b/gui/app.pro @@ -1,4 +1,4 @@ -# $Id: app.pro,v 1.17 2010/06/03 15:01:24 robertl Exp $ +# $Id: app.pro,v 1.18 2010/06/19 23:59:06 robertl Exp $ # CONFIG += qt release @@ -11,7 +11,7 @@ ICON = images/appicon.icns QT += network \ xml \ - webkit + webkit \ unix:DESTDIR = objects unix:MOC_DIR = objects @@ -25,12 +25,13 @@ UI_DIR = tmp RESOURCES = app.qrc RC_FILE = app.rc -mac:TARGET=GPSBabelFE win32:TARGET=GPSBabelFE unix:TARGET=gpsbabelfe-bin +mac:TARGET=GPSBabelFE FORMS += aboutui.ui FORMS += advui.ui +FORMS += donate.ui FORMS += filterui.ui FORMS += gmapui.ui FORMS += mainwinui.ui @@ -39,10 +40,12 @@ FORMS += preferences.ui FORMS += rttrkui.ui FORMS += trackui.ui FORMS += upgrade.ui +FORMS += version_mismatch.ui FORMS += wayptsui.ui SOURCES += aboutdlg.cpp SOURCES += advdlg.cpp +SOURCES += donate.cpp SOURCES += dpencode.cpp SOURCES += filterdata.cpp SOURCES += filterdlg.cpp @@ -60,6 +63,7 @@ SOURCES += optionsdlg.cpp SOURCES += preferences.cpp SOURCES += processwait.cpp SOURCES += upgrade.cpp +SOURCES += version_mismatch.cpp macx:SOURCES += serial_mac.cpp unix:SOURCES += serial_unix.cpp windows:SOURCES += serial_win.cpp @@ -68,6 +72,7 @@ HEADERS += aboutdlg.h HEADERS += advdlg.h HEADERS += appname.h HEADERS += babeldata.h +HEADERS += donate.h HEADERS += filterdata.h HEADERS += filterdlg.h HEADERS += filterwidgets.h @@ -83,6 +88,7 @@ HEADERS += preferences.h HEADERS += processwait.h HEADERS += setting.h HEADERS += upgrade.h +HEADERS += version_mismatch.h TRANSLATIONS += gpsbabelfe_ru.ts TRANSLATIONS += gpsbabelfe_de.ts diff --git a/gui/babeldata.h b/gui/babeldata.h index c0b44cec1..c120b487e 100644 --- a/gui/babeldata.h +++ b/gui/babeldata.h @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: babeldata.h,v 1.7 2010/04/12 02:53:04 robertl Exp $ +// $Id: babeldata.h,v 1.8 2010/06/19 23:59:06 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -58,12 +58,17 @@ public: upgradeCheckTime(QDateTime(QDate(2001, 1, 1), QTime(0, 0))), installationUuid(QUuid::createUuid().toString()), upgradeCallbacks(0), + upgradeAccept(0), upgradeDeclines(0), upgradeErrors(0), upgradeOffers(0), + runCount(0), startupVersionCheck(true), reportStatistics(true), - allowBetaUpgrades(false) + allowBetaUpgrades(false), + ignoreVersionMismatch(false), + disableDonateDialog(false), + donateSplashed(QDateTime(QDate(2010, 1, 1), QTime(0, 0, 0))) { }; @@ -105,16 +110,21 @@ public: sg.addVarSetting(new BoolSetting("app.previewGmap", previewGmap)); sg.addVarSetting(new IntSetting("app.upgradeCheckMethod", upgradeCheckMethod)); sg.addVarSetting(new DateTimeSetting("app.upgradeCheckTime", upgradeCheckTime)); + sg.addVarSetting(new DateTimeSetting("app.donateSplashed", donateSplashed)); sg.addVarSetting(new StringSetting("app.installationUuid", installationUuid)); sg.addVarSetting(new IntSetting("app.upgradeCallbacks", upgradeCallbacks)); + sg.addVarSetting(new IntSetting("app.upgradeAccept", upgradeAccept)); sg.addVarSetting(new IntSetting("app.upgradeDeclines", upgradeDeclines)); sg.addVarSetting(new IntSetting("app.upgradeErrors", upgradeErrors)); sg.addVarSetting(new IntSetting("app.upgradeOffers", upgradeOffers)); + sg.addVarSetting(new IntSetting("app.runCount", runCount)); // Global preferences. sg.addVarSetting(new BoolSetting("app.startupVersionCheck", startupVersionCheck)); sg.addVarSetting(new BoolSetting("app.reportStatistics", reportStatistics)); sg.addVarSetting(new BoolSetting("app.allowBetaUpgrades", allowBetaUpgrades)); + sg.addVarSetting(new BoolSetting("app.ignoreVersionMismatch", ignoreVersionMismatch)); + sg.addVarSetting(new BoolSetting("app.disableDonateDialog", disableDonateDialog)); } @@ -152,14 +162,19 @@ public: QDateTime upgradeCheckTime; QString installationUuid; int upgradeCallbacks; + int upgradeAccept; int upgradeDeclines; int upgradeErrors; int upgradeOffers; + int runCount; // Global preferences. bool startupVersionCheck; bool reportStatistics; bool allowBetaUpgrades; + bool ignoreVersionMismatch; + bool disableDonateDialog; + QDateTime donateSplashed; }; diff --git a/gui/donate.cpp b/gui/donate.cpp new file mode 100644 index 000000000..970c8bfab --- /dev/null +++ b/gui/donate.cpp @@ -0,0 +1,37 @@ +// -*- C++ -*- +//------------------------------------------------------------------------ +// +// Copyright (C) 2010 Robert Lipe +#include + +// A completely simple QDialog, in a class of its own for layout. +Donate::Donate(QWidget *parent) : QDialog(parent) +{ + ui.setupUi(this); + connect(ui.contributeButton, SIGNAL(clicked()), this, SLOT(contributeClicked())); +} + +void Donate::contributeClicked() +{ + QDesktopServices::openUrl(QUrl("http://www.gpsbabel.org/contribute.html")); + close(); +} diff --git a/gui/donate.h b/gui/donate.h new file mode 100644 index 000000000..0b6ae2bb5 --- /dev/null +++ b/gui/donate.h @@ -0,0 +1,46 @@ +// -*- C++ -*- +//------------------------------------------------------------------------ +// +// Copyright (C) 2010 Robert Lipe +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 +// USA +// + +#ifndef DONATE_H +#define DONATE_H + +#include "ui_donate.h" + +class Donate: public QDialog { + Q_OBJECT + + public: + Donate(QWidget *parent); + void showNever(bool f) { + ui.neverAgain->setVisible(f); + ui.textLine2->setVisible(f); + } + bool neverAgain() { return ui.neverAgain->isChecked(); } + + private: + Ui_Donate ui; + + private slots: + void contributeClicked(); + +}; + +#endif diff --git a/gui/donate.ui b/gui/donate.ui new file mode 100644 index 000000000..2fae6ead2 --- /dev/null +++ b/gui/donate.ui @@ -0,0 +1,134 @@ + + + Donate + + + + 0 + 0 + 351 + 300 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 400 + 300 + + + + Support GPSBabel + + + + + 10 + 13 + 312 + 249 + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">GPSBabel is free software built and supported by volunteers. It consumes vast amounts of time to create and support the software as well as money for mapping programs, GPS receivers, and development fixtures. Please see how you can <a href="http://www.gpsbabel.org"><span style=" text-decoration: underline; color:#0000ff;">contribute time or via PayPal (no account needed) or Google Checkout.</span></a></p></body></html> + + + true + + + + + + + <p>Of course, if you've already contributed to the project or you just can't help the project, please check the box below to never see this message again.</p> + + + true + + + + + + + Never show this message again. + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + No, Thanks + + + + + + + Contribute + + + false + + + true + + + + + + + + + + + + dismissButton + clicked() + Donate + close() + + + 139 + 247 + + + 198 + 141 + + + + + diff --git a/gui/gpsbabelfe_es.qm b/gui/gpsbabelfe_es.qm index 265473a05..8bc858104 100644 Binary files a/gui/gpsbabelfe_es.qm and b/gui/gpsbabelfe_es.qm differ diff --git a/gui/gpsbabelfe_it.qm b/gui/gpsbabelfe_it.qm index ce06aba78..69663a79d 100644 Binary files a/gui/gpsbabelfe_it.qm and b/gui/gpsbabelfe_it.qm differ diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index c525f350f..64d75b2fa 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: mainwindow.cpp,v 1.20 2010/04/12 02:53:03 robertl Exp $ +// $Id: mainwindow.cpp,v 1.21 2010/06/19 23:59:06 robertl Exp $ //------------------------------------------------------------------------ // // Copyright (C) 2009 S. Khai Mong . @@ -28,10 +28,12 @@ #include #include "mainwindow.h" +#include "../gbversion.h" #include "aboutdlg.h" #include "advdlg.h" #include "appname.h" #include "babeldata.h" +#include "donate.h" #include "filterdlg.h" #include "formatload.h" #include "gmapdlg.h" @@ -39,8 +41,8 @@ #include "optionsdlg.h" #include "preferences.h" #include "processwait.h" +#include "version_mismatch.h" #include "upgrade.h" -#include "../gbversion.h" const int BabelData::noType = -1; const int BabelData::fileType = 0; @@ -195,6 +197,13 @@ MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) upgrade->checkForUpgrade(babelVersion, bd.upgradeCheckTime, allowBetaUpgrades()); } + + if (!bd.ignoreVersionMismatch && babelVersion != VERSION) { + VersionMismatch vm(0, babelVersion, QString(appName) + QString(" " VERSION)); + + vm.exec(); + bd.ignoreVersionMismatch = vm.neverAgain(); + } } //------------------------------------------------------------------------ @@ -915,6 +924,16 @@ void MainWindow::closeActionX() if (wt.isValid()) { bd.upgradeCheckTime = wt; } + bd.runCount++; + + QDateTime now = QDateTime::currentDateTime(); + if((bd.runCount > 5) && (bd.donateSplashed.daysTo(now) > 30)) { + Donate donate(0); + if (bd.donateSplashed.date() == QDate(2010,1,1)) + donate.showNever(false); + donate.exec(); + bd.donateSplashed = now; + } saveSettings(); delete upgrade; upgrade = 0; diff --git a/gui/preferences.cpp b/gui/preferences.cpp index 3d01dfd3c..5366420e9 100644 --- a/gui/preferences.cpp +++ b/gui/preferences.cpp @@ -40,6 +40,7 @@ Preferences::Preferences(QWidget* parent, QList& formatList, ui_.startupCheck->setChecked(bd_.startupVersionCheck); ui_.reportStatisticsCheck->setChecked(bd_.reportStatistics); + ui_.ignoreVersionMismatchCheck->setChecked(bd_.ignoreVersionMismatch); connect (ui_.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked())); connect (ui_.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked())); @@ -79,6 +80,7 @@ void Preferences::acceptClicked() bd_.startupVersionCheck = ui_.startupCheck->isChecked(); bd_.reportStatistics = ui_.reportStatisticsCheck->isChecked(); + bd_.ignoreVersionMismatch = ui_.ignoreVersionMismatchCheck->isChecked(); accept(); } diff --git a/gui/preferences.ui b/gui/preferences.ui index 9b24efa1a..d66a009c7 100644 --- a/gui/preferences.ui +++ b/gui/preferences.ui @@ -6,8 +6,8 @@ 0 0 - 504 - 328 + 454 + 327 @@ -34,8 +34,8 @@ 23 18 - 234 - 43 + 387 + 62 @@ -53,6 +53,13 @@ + + + + Ignore mismatch between command line and GUI version. + + + @@ -103,19 +110,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - diff --git a/gui/upgrade.cpp b/gui/upgrade.cpp index 415fd7bcd..d39fe9620 100644 --- a/gui/upgrade.cpp +++ b/gui/upgrade.cpp @@ -1,5 +1,5 @@ // -*- C++ -*- -// $Id: upgrade.cpp,v 1.25 2010/04/12 02:53:04 robertl Exp $ +// $Id: upgrade.cpp,v 1.26 2010/06/19 23:59:06 robertl Exp $ /* Copyright (C) 2009, 2010 Robert Lipe, robertlipe@gpsbabel.org @@ -164,8 +164,10 @@ UpgradeCheck::updateStatus UpgradeCheck::checkForUpgrade( args += "&last_checkin=" + lastCheckTime.toString(Qt::ISODate); args += QString("&ugcb=%1").arg(bd_.upgradeCallbacks); args += QString("&ugdec=%1").arg(bd_.upgradeDeclines); + args += QString("&ugacc=%1").arg(bd_.upgradeAccept); args += QString("&ugoff=%1").arg(bd_.upgradeOffers); args += QString("&ugerr=%1").arg(bd_.upgradeErrors); + args += QString("&rc=%1").arg(bd_.runCount); int j = 0; @@ -212,7 +214,6 @@ void UpgradeCheck::readResponseHeader(const QHttpResponseHeader &responseHeader) void UpgradeCheck::httpRequestFinished(int requestId, bool error) { - bd_.upgradeCallbacks++; if (http == 0 || error) { bd_.upgradeErrors++; @@ -225,6 +226,7 @@ void UpgradeCheck::httpRequestFinished(int requestId, bool error) return; } + bd_.upgradeCallbacks++; QString oresponse(http->readAll()); QDomDocument document; @@ -287,8 +289,8 @@ void UpgradeCheck::httpRequestFinished(int requestId, bool error) information.setStandardButtons(QMessageBox::Yes | QMessageBox::No); information.setDefaultButton(QMessageBox::Yes); - information.setText(response); + information.setInformativeText(tr("Do you wish to download an upgrade?")); information.setDetailedText(upgradeText); @@ -296,6 +298,8 @@ void UpgradeCheck::httpRequestFinished(int requestId, bool error) case QMessageBox::Yes: // downloadUrl.addQueryItem("os", getOsName()); QDesktopServices::openUrl(downloadUrl); + bd_.upgradeAccept++; + break; default: ; bd_.upgradeDeclines++; } diff --git a/gui/version_mismatch.cpp b/gui/version_mismatch.cpp new file mode 100644 index 000000000..62560299d --- /dev/null +++ b/gui/version_mismatch.cpp @@ -0,0 +1,34 @@ +// -*- C++ -*- +//------------------------------------------------------------------------ +// +// Copyright (C) 2010 Robert Lipe setText(ver1); + ui.ClVersion->adjustSize(); + + ui.GuiVersion->setText(ver2); + ui.GuiVersion->adjustSize(); +} diff --git a/gui/version_mismatch.h b/gui/version_mismatch.h new file mode 100644 index 000000000..2c88706a0 --- /dev/null +++ b/gui/version_mismatch.h @@ -0,0 +1,39 @@ +// -*- C++ -*- +//------------------------------------------------------------------------ +// +// Copyright (C) 2010 Robert Lipe +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 +// USA +// + +#ifndef VERSION_MISMATCH_H +#define VERSION_MISMATCH_H + +#include + +#include "ui_version_mismatch.h" + +class VersionMismatch: public QDialog { + public: + VersionMismatch(QWidget *parent, const QString &ver1, + const QString &ver2); + bool neverAgain() { return ui.neverAgain->isChecked(); } + + private: + Ui_VersionMismatch ui; +}; + +#endif diff --git a/gui/version_mismatch.ui b/gui/version_mismatch.ui new file mode 100644 index 000000000..880aefdf7 --- /dev/null +++ b/gui/version_mismatch.ui @@ -0,0 +1,168 @@ + + + VersionMismatch + + + + 0 + 0 + 346 + 144 + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 400 + 300 + + + + GPSBabel Version Mismatch + + + + + + <b>A version mismatch has been detected.</b> + + + + + + + + + GPSBabel command line version: + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + GPSBabel GUI version: + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Never show this message again. + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ignore + + + + + + + + + + + buttonBox + accepted() + VersionMismatch + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + VersionMismatch + reject() + + + 316 + 260 + + + 286 + 274 + + + + +